// mock/user.ts
// 使用函数
let videos = [
	'https://lf-cdn.trae.com.cn/obj/trae-com-cn/InteractionFinal.mp4',
	'https://lf-cdn.trae.com.cn/obj/trae-com-cn/CompletionFinal.mp4',
	'https://lf-cdn.trae.com.cn/obj/trae-com-cn/BuilderFinal.mp4',
	'https://lf-cdn.trae.com.cn/obj/trae-com-cn/bannerIntroNew.mp4',
	'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4'
]
// 打乱数据
const shuffleArray = (array) => {
	for (let i = array.length - 1; i > 0; i--) {
		const j = Math.floor(Math.random() * (i + 1))
		;[array[i], array[j]] = [array[j], array[i]]
	}
	return array.map((item, index) => {
		return {
			id: index,
			url: item
		}
	})
}
export default [
	// 获取首页标签list
	{
		url: '/api/homeChannel/info',
		method: 'post',
		response: (request: any) => {
			// 有就返回成功信息
			return {
				code: 200,
				data: [{ name: '关注' }, { name: '推荐' }]
			}
		}
	},
	// 获取推荐视频
	{
		url: '/api/video/recommend',
		method: 'post',
		response: (request: any) => {
			// 有就返回成功信息
			return {
				code: 200,
				data: shuffleArray(videos)
			}
		}
	}
]
